<?php

/**
 * Created by JetBrains PhpStorm.
 * User: Administrator
 * Date: 13-11-8
 * Time: 上午9:50
 * 显示票付通会员列表
 */
if($_SESSION['dtype']!=9) {
    exit("不合法的身份访问！");
}
include 'common/autoload.php';
include COMMONPATH.'page.php';


$currentPage =$_REQUEST["currentPage"]?$_REQUEST["currentPage"]:1;
$pageSize    =$_REQUEST["pageSize"]?$_REQUEST["pageSize"]:10;
$offset     =($currentPage-1)*$pageSize;
$sql = <<<SQL
SELECT w.fid,w.name,w.hash,w.username,w.appid,
w.appsecret,w.token,w.ac_type,w.create_time,w.encodingAESKey,
m.dname
SQL;
if ($_GET['username'])
    $where  =" where w.username like '%{$_GET['username']}%'";
if ($_GET['hash'])
    $where .=" where hash like '%{$_GET['hash']}%'";

$sql_from  = " FROM pft_wx w LEFT JOIN pft_member m ON m.id=w.fid";
$sql_limit .= " order by w.create_time desc LIMIT $offset,$pageSize";

$sql .= $sql_from.$where.$sql_limit;
$GLOBALS['le']->query($sql);
$mem_list = array();
while($row=$GLOBALS['le']->fetch_assoc()) {
    $mem_list[] = $row;
}
$sql_total = "SELECT COUNT(*) as total";
$sql_total .= $sql_from.$where;
$GLOBALS['le']->query($sql_total);
$GLOBALS['le']->fetch_assoc();
$total_rows = $GLOBALS['le']->f('total');
include("common/header.html");
include("common/left.html");
?>
</head>
<style>
#input_w{width:30px;}
</style>
<body>
<link rel="stylesheet" type="text/css" href="css/wechat_t.css">
<link rel="stylesheet" href="/css/aliceui.min.css"/>
<link rel="stylesheet" href="/css/resetui.css"/>
<link rel="stylesheet" href="/css/page.css"/>
<link rel="stylesheet" href="css/list.css"/>
<link rel="stylesheet" href="//www.16u.com/manage/admin/css/dialog.css"/>
<div class="r_content" id="bind_tao">     
<h3 class="mc_title">
    <span class="mctit_1"><span class="mctit_2">微信公众号列表</span></span>
</h3>
<div class="wrap">
   <div class="ui-table-container">
        <table class="ui-table ui-table-noborder"><!-- 可以在class中加入ui-table-inbox或ui-table-noborder分别适应不同的情况 -->
        <thead>
        <tr>
			<th>公众号</th>
            <th>提交时间</th>
            <th>会员ID</th>
            <th>企业名</th>
			<th>操作</th>
        </tr>
        </thead>
        <tbody id="tao_list_tbd">
        <? foreach($mem_list as $list): ?>
        <tr id="tr_<?=$list['log_id']?>">
			<td><?=$list['name']?></td>
            <td><?=$list['create_time']?></td>
            <td><?=$list['fid']?></td>
            <td><?=$list['dname']?></td>
            <td><a act="del" class="del_up" href="http://www.12301.cc/call/handle.php?from=order_del_up&fid=<?=$list['fid']?>" >删除</a>|<a href="wechat.html">修改</a></td>
        </tr>
        <? endforeach; ?>
        </tbody>
    </table>
        <?page($total_rows,$currentPage,$pageSize);?>
    </div>
</div>
</div>
<script>
	$(".del_up").click(function(){
		if($(this).attr("act")=="del"){
			if(!confirm("确定要删除？")) return false;
		}
		$.ajax({
			"url":$(this).attr("href"), 
			"dataType":"json",
			"success":function(data){
				if(data.outcome==1){
					alert("删除成功");
					window.location=window.location.href;
				}else{
					alert("删除失败:"+data.msg);
				}
			}
		})
		return false;
	});
</script>
<?include 'common/footer.html';?>